<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"></c:set>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>新闻资讯</title>

</head>
<body>
<jsp:include page="header.jsp"></jsp:include>
<div id="container">
    <div id="buttons">
        <span index="1" class="on"></span>
        <span index="2"></span>
        <span index="3"></span>
    </div>
    <a href="javascript:;" id="prev" class="arrow"><img src="${ctx}/static/pc/img/l.png"/></a>
    <a href="javascript:;" id="next" class="arrow"><img src="${ctx}/static/pc/img/r.png"/></a>
</div>

<ul class="breadnav clearfix">
    <li class="bnav-item"><a href="${ctx}/index/list.do">首页</a></li>
    <li class="bnav-item">&lt;</li>
    <li class="bnav-item"><a href="${ctx}/news/list.do">新闻资讯</a></li>
</ul>
<div class="newslist-wrap">
    <p class="newslist-tit">新闻资讯</p>
    <c:forEach var="nl" items="${newsList}" varStatus="ss">
    <dl class="newslist-box clearfix">
        <dt class="newslist-pic">
            <img src="${ctx}/static/pc/${nl.news_img}"/>
        </dt>
        <dd class="newslist-txt">
            <a href="news-con.do?newsId=${nl.news_id}" class="newslist-font24">${nl.news_title}</a>
            <ul class="newslist-ul">
                <li class="newslist-li">
                    <p class="newslist-time"><fmt:formatDate value="${nl.news_addtime}" pattern="yyyy-MM-dd"/></p>
                </li>
                <li class="newslist-li">
                    <a href="news-con.jsp" class="newslist-con">${nl.news_content}</a>
                </li>
                <li class="newslist-li"><a class="newslist-link" href="news-con.do?newsId=${nl.news_id}">&lt;阅读全文&gt;</a></li>
            </ul>
        </dd>
    </dl>
        <span class="news-line">
				<img src="${ctx}/static/pc/img/news-line.png"/>
			</span>
    </c:forEach>

    <%--分页调用--%>
    <jsp:include page="paging.jsp"></jsp:include>
</div>

<jsp:include page="footer.jsp"></jsp:include>

<%--引入公共样式--%>
<jsp:include page="common.jsp"></jsp:include>
</body>
<!--jq调用-->

<script type="text/javascript">


    /*js去掉所有html标记的函数： */
    function delHtmlTag(str) {
        return str.replace(/<[^>]+>/g, "");//去掉所有的html标记
    }

    //截取文本方式一
   /* $(function () {
        //获取所有内容标签
        var  newslist_cons=$(".newslist-con");
        newslist_cons.each(function () {
            var con=$(this).text();
            if (con.length>150){
                con=con.substring(0,150)+"......";
            }
            $(this).html(con);//重新赋值
        });
    })*/
    //方法二
    $(function () {
        //获取所有内容标签
        var  newslist_cons=$(".newslist-con");
        newslist_cons.each(function () {
            var con=delHtmlTag($(this).html());
            if (con.length>150){
                con=con.substring(0,150)+"......";
            }
            $(this).html(con);//重新赋值
        });
    })
</script>
</html>

